<template>
  <div>
    <ul class="mui-table-view">
      <li class="mui-table-view-cell mui-media" v-for="item in newsList" :key="item.link">
        <router-link :to="'/home/news/news-info/' + id">
          <img
            class="mui-media-object mui-pull-left"
            src="https://images.gitee.com/uploads/66/2138166_SakumyZ.png?1548517497"
          >
          <div class="mui-media-body">
            <h1>{{item.title}}</h1>
            <p class="mui-ellipsis">
              <span>发表时间：{{item.pubdate}}</span>
              <span>点击： 2次</span>
            </p>
          </div>
        </router-link>
      </li>
    </ul>
  </div>
</template>

<script>

export default {
  data () {
    return {
      id: '1',
      newsList: []
    }
  },
  methods: {
    getNewsList: function () {
      this.$axios.get('http://api.komavideo.com/news/list')
        .then(res => {
          this.newsList = res.data;
        })
        .catch(err => {
          console.log(error)
        });
    }
  },

  created () {
    this.getNewsList();
  }

}
</script>

<style scoped>
.mui-table-view li h1 {
  font-size: 14px;
}

.mui-ellipsis {
  font-size: 12px;
  color: #26a2ff;
  display: flex;
  justify-content: space-between;
}
</style>
